package com.kingsalert.kingsalert.bean;

import android.text.TextUtils;

import com.kingsalert.kingsalert.adapter.PermissionViewAdapter;
import com.kingsalert.kingsalert.listener.PermissionListener;

public class PermissionInfo {

    private final Integer iconResId;
    private final String title;
    private final String text;
    private final PermissionListener listener;

    private final String page;

    private PermissionViewAdapter.PermissionDialogHolder holder;

    public PermissionInfo(Integer iconResId, String title, String text, PermissionListener listener,String page) {
        this.iconResId = iconResId;
        this.title = title;
        this.text = text;
        this.listener = listener;
        this.page = page;
    }

    public Integer getIconResId() {
        return iconResId;
    }

    public String getTitle() {
        return title;
    }

    public String getText() {
        if (TextUtils.isEmpty(text)) return "";
        return text;
    }

    public PermissionListener getListener() {
        return listener;
    }

    public void setHolder(PermissionViewAdapter.PermissionDialogHolder holder) {
        this.holder = holder;
    }

    public PermissionViewAdapter.PermissionDialogHolder getHolder() {
        return holder;
    }

    public void setViewAgree(){
        if (holder!=null) holder.afterAgree();
    }

    public String getPage() {
        if (TextUtils.isEmpty(page)) return "";
        return page;
    }
}
